/**
 * class name: slide$,
 * copyright: maximus zhang,
 * License: MIT-LICENSE,
 * contact: maximus.zhang@gmail.com,
 * required-js: http://hcjs.googlecode.com/svn/trunk/hc.js,
 * update: http://hcjs.googlecode.com/svn/trunk/slide.js
 *
 */
function slide$(){
    var A = arguments,
        _ = this;
    _ = ext$( _, ext$( {
        id : 'news_slide',
        elem : me.body,
        news : '',
        css : 'color:#00f;font-weight:bold;text-decoration:underline;background:#e9effe;border:solid 1px #abf;padding:1px 3px 2px 3px;margin-left:2px;margin-right:1px;cursor:pointer;'
        }, A[0] ) );
    _.uitype = 'slide$';
    _.curx = 0 ;

    _.elem = $(_.elem) || me.body;
    _.news = isArray(_.news) ? _.news : [_.news];

    _.add$ = function(nx){
        if ( typeof nx=='string' ) {
            _.news.push(nx);
        }

        if ( isArray(nx) ) {
            _.news.concat(nx);
        }

    return _;
    };

    _.go$ = function(x){
        if ( !x ) {
            x=0;
        }

        var L = _.news.length;

        _.curx += x;
        if ( _.curx<0 ) {
            _.curx = L-1;
        }

        if ( _.curx>=L ) {
            _.curx = 0;
        }

        _.newx.empty$();
        _.newx.innerHTML = _.news[_.curx];

    return _;
    };

    _.init$ = function(){
        _.$ = el$('div').appendTo$(_.elem);

        _.newx = el$('div').appendTo$(_.$);

        _._ = el$('div').appendTo$(_.elem);//for < >
        _._.style.cssText = 'position:absolute;top:0;right:6px;line-height:24px;';

        _.lt = el$('span').appendTo$(_._);
        _.lt.style.cssText = _.css;
        _.lt.innerHTML = '&lt;';
        _.lt.onclick = _.lt.ondblclick = function(){
            _.go$(-1);
        return false;
        };

        _.gt = el$('span').appendTo$(_._);
        _.gt.style.cssText = _.css;
        _.gt.innerHTML = '&gt;';

        _.gt.onclick = _.gt.ondblclick = function(){
            _.go$(1);
        return false;
        };

        _.lt.onmouseover = _.gt.onmouseover = function(){
            this.style.backgroundColor = '#f9f9f9';
            this.style.textDecoration = 'none';
            this.style.color = '#801204';
        };

        _.lt.onmouseout = _.gt.onmouseout = function(){
            this.style.backgroundColor = '#e9effe';
            this.style.textDecoration = 'underline';
            this.style.color = '#00f';
        };

    return _.go$();
    };
}